using System;
using Sinacor.Servico.Bovespa.Cliente.Service.DataContract.Response;
using Sinacor.Servico.Bovespa.Cliente.BusinessEntity;
using System.Collections.Generic;
using System.ComponentModel;

namespace Sinacor.Servico.Bovespa.Cliente.Service.ServiceImplementation.Translator
{
    public static class TranslateBetweenEmissorOrdemResponseAndEmissorOrdem
    {
        public static Sinacor.Servico.Bovespa.Cliente.Service.DataContract.Response.EmissorOrdemResponse TranslateEmissorOrdemToEmissorOrdemResponse(Sinacor.Servico.Bovespa.Cliente.BusinessEntity.EmissorOrdem from)
        {
            Sinacor.Servico.Bovespa.Cliente.Service.DataContract.Response.EmissorOrdemResponse to = new Sinacor.Servico.Bovespa.Cliente.Service.DataContract.Response.EmissorOrdemResponse();
            to.NomeEmissor = from.NomeEmissor;
            return to;
        }

        public static Sinacor.Servico.Bovespa.Cliente.BusinessEntity.EmissorOrdem TranslateEmissorOrdemResponseToEmissorOrdem(Sinacor.Servico.Bovespa.Cliente.Service.DataContract.Response.EmissorOrdemResponse from)
        {
            Sinacor.Servico.Bovespa.Cliente.BusinessEntity.EmissorOrdem to = new Sinacor.Servico.Bovespa.Cliente.BusinessEntity.EmissorOrdem();
            to.NomeEmissor = from.NomeEmissor;
            return to;
        }

        public static List<DataContract.Response.EmissorOrdemResponse> 
            TranslateEmissorOrdemCollectionEmissorOrdemResponseCollection(List<BusinessEntity.EmissorOrdem> from)
        {
            List<DataContract.Response.EmissorOrdemResponse> to = null;

            if (from != null)
            {
                to = new List<DataContract.Response.EmissorOrdemResponse>();
                foreach (BusinessEntity.EmissorOrdem listaEmissorOrdem in from)
                {
                    to.Add(TranslateBetweenEmissorOrdemResponseAndEmissorOrdem.
                        TranslateEmissorOrdemToEmissorOrdemResponse(listaEmissorOrdem));
                }
            }
            return to;
        }
    }
}

